﻿using RestSharp;
using System;
using System.Collections.Generic;
using System.Text;
using Ymatou.ServiceCenter;

namespace Ymatou.User.Dto.Auth
{
    /// <summary>
    /// 登录认证
    /// </summary>
    [Resource("auth.ymatou.com", "/json/reply/LoginAuthRequestDto", Method.GET, ParameterBuildType.UrlQueryString)]
    public class LoginAuthRequestDto
    {
        /// <summary>
        /// 登录ID（loginId,mail,mobile）
        /// </summary>
        public string LoginId { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        public string Pas { get; set; }
        /// <summary>
        /// 客户端IP
        /// </summary>
        public string ClientIp { get; set; }
        /// <summary>
        /// 说明
        /// </summary>
        public string Description { get; set; }
        /// <summary>
        /// 登录来源 。登录客户端类型：www.ymatou.com ，app，dms，xxx.admin,ali,weibo
        /// </summary>
        public string SourceType { get; set; }
        /// <summary>
        /// 是否更新token
        /// </summary>
        public bool UpdateToken { get; set; }
        /// <summary>
        ///  SSOTokenTimeOut（TimeSpan.Ticks）
        /// </summary>
        public long SSOTokenTimeOut { get; set; }
        /// <summary>
        /// TerminalSource
        /// </summary>
        public string TSource { get; set; }

        public string DeviceId { get; set; }
        public string ClientId { get; set; }
        /// <summary>
        ///  业务端应用类型通道 （0，老通道，不走防撞库流程，1，新通道，走防撞库流程）
        /// </summary>
        public int AppTypeChanndel { get; set; }

        /// <summary>
        /// Token来源
        /// </summary>
        public string TokenSource { get; set; }
        
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder(" LoginAuthRequestDto Parameters： ");
            sb.AppendFormat("LoginId: {0}, ", LoginId);
            sb.AppendFormat("ClientIp: {0}, ", ClientIp);
            sb.AppendFormat("SourceType: {0}, ", SourceType);
            sb.AppendFormat("TSource: {0}, ", TSource);
            sb.AppendFormat("AppTypeChanndel: {0}, ", AppTypeChanndel);
            sb.AppendFormat("DeviceId: {0}, ", DeviceId);
            sb.AppendFormat("ClientId: {0}, ", ClientId);
            sb.AppendFormat("UpdateToken: {0}, ", UpdateToken);            
            sb.AppendFormat("SSOTokenTimeOut: {0}, ", SSOTokenTimeOut);
            sb.AppendFormat("Description: {0}, ", Description);
            sb.AppendFormat("TokenSource: {0}", TokenSource);

            string str = sb.ToString();
            return str.Length > 1000 ? str.Substring(0, 1000) : str;
        }
    }
}
